﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// http://codekata.com/kata/kata06-anagrams/
/// </summary>
namespace RandomKatas.Kata06
{
    public class Anagrams
    {
        public IEnumerable<List<string>> FindAnagrams(IEnumerable<string> wordlist)
        {
            return wordlist.GroupBy(x => new string(x.OrderBy(c => c).ToArray()))
                .Where(x => x.Count() > 1).Select(x => x.ToList());
        }
    }
}
